package com.vogelsk.archangelsk.gui;

import java.awt.Image;

import com.vogelsk.archangelsk.creatures.Tank;
import com.vogelsk.archangelsk.creatures.util.Direction;

public class TankImage {
	
	private Image facingLeftImage;
	private Image facingRightImage;
	private Image facingUpImage;
	private Image facingDownImage;
	private Image destroyedImage;

	public Image getCurrentImage(Tank owner){
		if (owner.isDestroyed()){
			return destroyedImage;
		}
		
		Image tankImage = null;
		
		if (owner.getDirection().equals(Direction.RIGHT)){
			tankImage = facingRightImage;
		}
		if (owner.getDirection().equals(Direction.LEFT)){
			tankImage = facingLeftImage;
		}
		if (owner.getDirection().equals(Direction.DOWN)){
			tankImage = facingDownImage;
		}
		if (owner.getDirection().equals(Direction.UP)){
			tankImage = facingUpImage;
		}
		return tankImage;
	}
	
	public TankImage(Image facingLeftImage, Image facingRightImage,
			Image facingUpImage, Image facingDownImage, Image destroyedImage) {
		super();
		this.facingLeftImage = facingLeftImage;
		this.facingRightImage = facingRightImage;
		this.facingUpImage = facingUpImage;
		this.facingDownImage = facingDownImage;
		this.destroyedImage = destroyedImage;
	}
	
	public Image getFacingLeftImage() {
		return facingLeftImage;
	}
	public void setFacingLeftImage(Image facingLeftImage) {
		this.facingLeftImage = facingLeftImage;
	}
	public Image getFacingRightImage() {
		return facingRightImage;
	}
	public void setFacingRightImage(Image facingRightImage) {
		this.facingRightImage = facingRightImage;
	}
	public Image getFacingUpImage() {
		return facingUpImage;
	}
	public void setFacingUpImage(Image facingUpImage) {
		this.facingUpImage = facingUpImage;
	}
	public Image getFacingDownImage() {
		return facingDownImage;
	}
	public void setFacingDownImage(Image facingDownImage) {
		this.facingDownImage = facingDownImage;
	}

	public void setDestroyedImage(Image destroyedImage) {
		this.destroyedImage = destroyedImage;
	}

	public Image getDestroyedImage() {
		return destroyedImage;
	}
}
